package httydgame;
import java.awt.Rectangle;
import java.util.ArrayList;

public class Dragon {
	private int centerX = 200;
	private int centerY = 240;
	private int lives = 3;

	private ArrayList<Projectile> projectiles = new ArrayList<Projectile>();
	
	private int speedX = 0;
	private int speedY = 5;
	
	public Rectangle rect1 = new Rectangle(0,0,0,0);
	public Rectangle rect2 = new Rectangle(0,0,0,0);
	public Rectangle rect3 = new Rectangle(0,0,0,0);
	
	public void update()
	{
		centerX += speedX; 
		centerY += speedY;
		rect1.setRect(centerX - 39, centerY - 9, 61, 48);
		rect2.setRect(centerX - 93, centerY - 36, 193, 27);
		rect3.setRect(centerX + 22, centerY - 9, 61, 30);
	}
	
	// collision: 
		// Wings: x: 61 - 183 y: 30 - 78
		// Body: x: 7 - 200 y: 3 - 30
	public int getLives() {
		return lives;
	}

	public void setLives(int lives) {
		this.lives = lives;
	}
	
	public void moveUp()
	{
		speedY = -5;
	}
	
	public void moveDown()
	{
		speedY = 10;
	}
	
	public void moveLeft()
	{
		speedX = -5; 
	}
	
	public void moveRight()
	{
		speedX = 5;
	}
	
	public void stopX()
	{
		speedX = 0;
	}
	
	public void stopY()
	{
		speedY = 2;
	}
	
	public int getCenterX()
	{
		return centerX;
	}
	
	public int getCenterY()
	{
		return centerY;
	}
	
	public ArrayList getProjectiles()
	{
		return projectiles;
	}
	
	public void shoot()
	{
		Projectile p = new Projectile(centerX + 60, centerY - 50, 7);
		projectiles.add(p);
	}
	
}
	



